//
// Created by dg on 2024/1/2.
//

#ifndef MY_APPLICATION_BLYUVTEXTUREFRAME_H
#define MY_APPLICATION_BLYUVTEXTUREFRAME_H

#include "./BLTextureFrame.h"

class BLYUVTextureFrame: public BLTextureFrame{

private:
    uint8_t *yuv_frame;
    bool writeFlag;
    GLuint textures[3];
    int initTexture();

    uint8_t *luma;
    uint8_t *chromaB;
    uint8_t *chromaR;
public:
    BLYUVTextureFrame();
    virtual ~BLYUVTextureFrame();

    void setVideoFrame(uint8_t *yuvFrame, int length);

    bool createTexture() override;
    void updateTexImage(int width, int height) override;
    bool bindTexture(GLint *uniformSamplers) override;
    void dealloc() override;
};


#endif //MY_APPLICATION_BLYUVTEXTUREFRAME_H
